package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 定转活 成功
 */
public class DtohSuccessPp extends BasePopupView {
    Unbinder bind;
    @BindView(R.id.switch_success_name)
    TextView switchSuccessName;
    @BindView(R.id.switch_success_usernum)
    TextView switchSuccessUsernum;
    @BindView(R.id.switch_success_usernmae)
    TextView switchSuccessUsernmae;
    @BindView(R.id.switch_success_dealtype)
    TextView switchSuccessDealtype;


    @BindView(R.id.switch_success_okbtn)
    Button switchSuccessOkbtn;

    DtohSuccessCallBack mDtohSuccessCallBack;
    String mName;//交易名称
    String mBanknum;//卡号
    String mUserName;//用户名
    String mType;// 产品名称
    String mMoney;//金额

    public void setmName(String mName) {
        this.mName = mName;
    }

    public void setmBanknum(String mBanknum) {
        this.mBanknum = mBanknum;
    }

    public void setmUserName(String mUserName) {
        this.mUserName = mUserName;
    }

    public void setmType(String mType) {
        this.mType = mType;
    }

    public void setmMoney(String mMoney) {
        this.mMoney = mMoney;
    }

    public DtohSuccessPp(@NonNull Context context, DtohSuccessCallBack htoDSuccessCallBack) {
        super(context);
        this.mDtohSuccessCallBack = htoDSuccessCallBack;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);

        switchSuccessName.setText(mType);
        switchSuccessUsernum.setText(mBanknum);
        switchSuccessUsernmae.setText(mUserName);
        switchSuccessDealtype.setText(mMoney);
    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.dtoh_success_layout;
    }

    @OnClick({R.id.switch_success_okbtn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.switch_success_okbtn:
                mDtohSuccessCallBack.DtoHSuccessPrint();
                break;
        }
    }

    public interface DtohSuccessCallBack {
        void DtoHSuccessPrint();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }
}
